﻿using BCService.OA.WorkflowTemplate.WorkflowTemplateBusiness;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlackCoffeeRESTful.Controllers.Management.OA.Workflow.WorkflowBusiness
{
    /// <summary>
    /// 工作流业务
    /// </summary>
    [ApiExplorerSettings(GroupName = "OAAdmin")]
    [Route("api/v1/sim/[controller]")]
    public class WorkflowBusinessController : ManagementBaseController
    {
        private readonly IWorkflowTemplateBusinessService workflowTemplateBusinessService;

        public WorkflowBusinessController(IWorkflowTemplateBusinessService workflowTemplateBusinessService)
        {
            this.workflowTemplateBusinessService = workflowTemplateBusinessService;
        }

        /// <summary>
        /// 获取工作流我的中允许发起的业务列表
        /// </summary>
        /// <param name="categoryCode">工作流分类Code</param>
        /// <response code="200">获取允许发起的业务列表。</response>
        /// <returns></returns>
        [HttpGet("[action]")]
        public IActionResult AllowInitiateList([FromQuery(Name = "category_code")] string categoryCode)
        {
            return this.Ok(this.workflowTemplateBusinessService.GetAllowInitiateList(this.Admin.CompanyId,this.Admin.DepartmentId.HasValue?this.Admin.DepartmentId.Value:0,this.Admin.PositionId,this.Admin.AdminId,categoryCode));
        }
    }
}
